<?php 
/*
* View implements
*/

class View{
	private $template;
	private $data = array();

	public function __construct($template){
		$this->template = $template;
	}

	public function SetData($name,$value){
		$this->data[$name] = $value;
	}

	public function GetDate($name){
		if(key_exists($data,$name))
			return $this->data[$name];
	}


	public function SetTemplate($template){
		$this->template = $template;
	}
	/*
	* render view to html
	*/
	public function Render(){
		if(file_exists($this->template)){
			extract($this->data);
			ob_start();
			include $this->template;
			$output = ob_get_contents();
			ob_end_clean();
			echo $output;
	}			
	}

}
?>
